<?php
class ToolService
{
	public function __construct()
	{
		$config			= C('LtConfig')->get('pisces');
		$this->apiUrl	= $config['url']['api'];
		$vip			= C('SettingService')->get('vip_setting',true);
		$this->vip		= $vip;
	}
	
	public function request($module,$action,$params)
	{
		$url		= $this->apiUrl.'module='.$module.'&action='.$action;
		if(!empty($params))
		{
			foreach($params as $k=>$v)
			{
				$url	.= '&'.$k.'='.urlencode($v);
			}
		}
		if($this->vip)
		{
			$url	.= '&id='.$this->vip['id'].'&seccode='.$this->vip['seccode'];
		}
		$content	= file_get_contents($url);
		if(empty($content))
		{
			return false;
		}
		return json_decode($content,true);
	}
}
?>